<template>
  <div>
    <div class="title">
      {{ activeIndex === "1" ? "门店销售排名" : "用户访问排名" }}
    </div>
    <div class="item" v-for="(item, index) in rankList" :key="item.no">
      <div class="no" :class="index < 3 && 'active'">{{ item.no }}</div>
      <div class="name">{{ item.name }}</div>
      <div class="count">{{ item.count }}</div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "RightView",
  props: ["activeIndex"],
  computed: {
    ...mapState({
      orderRank: state => state.echarts.echartsData.orderRank,
      userRank: state => state.echarts.echartsData.userRank
    }),
    rankList() {
      if (this.activeIndex === "1") {
        return this.orderRank;
      } else {
        return this.userRank;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.title {
  margin-top: 50px;
}
.item {
  display: flex;
  font-size: 12px;
  align-items: center;
  margin: 10px 0;
  .no {
    width: 20px;
    height: 20px;

    text-align: center;
    border-radius: 50%;
    line-height: 20px;
    margin-right: 1px;
    &.active {
      background-color: #000;
      color: white;
    }
  }
  .name {
    width: 100px;
  }
}
</style>
